<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8" />
		<title></title>
		<link rel="stylesheet" type="text/css" href="/css/common.css" />
		<link rel="stylesheet" type="text/css" href="/bootstrap-3.3.7/css/bootstrap.min.css" />
		<link rel="stylesheet" type="text/css" href="/css/flatpickr.min.css" />
		<link rel="stylesheet" type="text/css" href="/css/font-awesome.css"/>
		<link rel="stylesheet" type="text/css" href="/dialog/css/dialog.css"/>
		<link rel="stylesheet" href="/css/shoufengqin.css">
		<link rel="stylesheet" type="text/css" href="/css/haha.css" media="screen" />


		<script src="/js/jquery-1.9.1.min.js" type="text/javascript" ></script>
		<script src="/js/google-maps.js" type="text/javascript" charset="utf-8"></script>
		<script src="/js/jquery.validate.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="/dialog/js/dialog.js" type="text/javascript" charset="utf-8"></script>
		<script src="/js/jquery.form.js"></script>
		<script src="/js/common.js"></script>
		<script src="/js/flatpickr.js" type="text/javascript" charset="utf-8"></script>
		<script src="/js/messages_zh.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="/js/shoufengqin.js"></script>
		<script src="/laydate/laydate.js"></script> <!-- 改成你的路径 -->
        <script type="text/javascript">
            $().ready(function(){
                $("#addform").validate({
                    rules:{
                        compname:"required",
                    },
                    message:{
                        compname:"此项必填",
                    }
                });
                // if(document.getElementsByName(compcode)[0].values()==null){
                 //    alert("请选择公司类型");
                 //    return false;
				// }
            });

            function checkVac() {
                //检查输入库存量格式
                checkNum();
                /*                //获取疫苗名称、生产企业和类型信息
                                var vacName=$("#vacId").val();
                                var comId=$("#comId").val();
                                var type=$("#typeId").val();
                                //新增的疫苗种类信息
                                var ymzlxz=vacName+"-"+type+"-"+comId;
                                //已经存在的所有疫苗种类信息
                                var ymzlAll=$("#ymzlAllId").val();
                                var ymzls=ymzlAll.split(";");
                                //判断是否包含新增的种类信息
                                var i = ymzls.length;
                                while (i--) {
                                    if (ymzls[i] === ymzlxz) {
                                        alert("这个种类的疫苗已经存在，不能修改");
                                        return false;
                                    }
                                }
                                //疫苗不存在则提交新增
                                $("#addform").submit();*/
            }
            function checkNum() {
                var re = /^[0-9]*$/ ;
                var s=$('#amountId').val();
                if(!re.test(s)){
                    alert("库存量必须为>=0的整数");
                    $('#amountId').val(null);
                    return;
                }
                $("#addform").submit();
            }
        </script>
	</head>

	<body>
		<!--顶部导航 -->
        <nav class="topNavItemBox">
            <div id="ItemBox">
                <div class="title">智慧溯源系统</div>
                <div class="subtitle">肉品溯源管理</div>
                <div class="rightUserInfo">
                    <div class="commentAvatarDiv">
                        <img class="commentAvatarImage" src="/images/people.jpg">
                    </div>
                    <div class="userName">
					<#if Session.curEmployeeInfo??>
                        <a href="/admin/logout">${Session.curEmployeeInfo.emName}</a>
					</#if>
                    </div>
                    <span class="glyphicon glyphicon-option-vertical userIcon" aria-hidden="true"></span>
                </div>
            </div>
        </nav>
		<div class="contain">
			<#include "leftPage.ftl">
		</div>
			<div id="middle1" class="page_main">
				<div id="middle2" class="page_content">
				<div class="add_title">
					<div class="second_title_main">疫苗库存</div>
					<div class="second_title_main_bread">   > </div>
                    <div class="second_title_main">修改疫苗种类信息</div>
				</div>
					<form id="addform" action="update" method="post">
						<ul>
							<li><label class="labelBeforinput">疫苗名称</label><input disabled="true" id="vacId" <#--name="vaccinename"--> value="${vaccineInfo.vaccinename}" class="bigInputtext" required type="text">(不可修改)</li>
                            <li><label class="labelBeforinput">疫苗类型</label>
								<select <#--name="vaccinetype"-->  class="bigInputtext" required id="typeId" disabled="true">
									<option value="1" <#if vaccineInfo.vaccinetype = 1>selected</#if>>1</option>
									<option value="2" <#if vaccineInfo.vaccinetype = 2>selected</#if>>2</option>
									<option value="3" <#if vaccineInfo.vaccinetype = 3>selected</#if>>3</option>
									<option value="4" <#if vaccineInfo.vaccinetype = 4>selected</#if>>4</option>
									<option value="5" <#if vaccineInfo.vaccinetype = 5>selected</#if>>5</option>
								</select>(不可修改)
							</li>
							<li><label class="labelBeforinput">生产企业</label>
								<select <#--name="manufactoryid"--> class="bigInputtext" required id="comId" disabled="true">
                                    <#list companyInfos as companyInfo>
                                            <option value="${companyInfo.gid}" <#if vaccineInfo.manufactoryid = companyInfo.gid>selected</#if>>${companyInfo.compname}</option>
                                    </#list>
								</select>(不可修改)</li>
                            <li><label class="labelBeforinput">库存量</label><input id="amountId" name="numinstore" value="${vaccineInfo.numinstore}" class="bigInputtext" required type="text" >*(请输入正整数)</li>
                            <li><input hidden="true" value="${ymzlAll}" id="ymzlAllId"/></li>
							<li><input type="button" value="确认" onclick="checkVac()"style="margin-left:50px;width: 100px;background-color: #00BFFF;" /></li>
						</ul>
                        <input name="numinstore" value="${vaccineInfo.numinstore}"  type="text" hidden="true">
                        <input name="vaccineid" value="${vaccineInfo.vaccineid}"  type="text" hidden="true">
					</form>
				
				</div>
			</div>
		</div>
		<div class="footer">
				<div class="footer_lineone">
					<span id="logo"></span>肉品溯源管理系统 
					<span class="footer_lineoneSpan"><a href="aboutus.html">关于我们</a></span>
					<span class="footer_lineoneSpan"><a target="_blank" href="http://www.cfsiw.com/">食品安全信息</a></span> 
					<span class="footer_lineoneSpan"><a href="suggestionAdd.ftl">联系我们</a></span>
				</div>
				<div class="footer_linetwo">
					 &copy;2017广东技术师范学院
				</div>
			</div>
	</body>
	<script type="text/javascript" charset="UTF-8">
		$(function() {
            //表单提交
            $("#addform").ajaxForm({
                success:function(data) {
                    var str = null;
                    var msg = null;
                    if(data.code == 0){
                        str = "success";
                        msg = "更新成功";
                        $.dialog({
                            type: 'info',
                            contentHtml: '<img class="info-icon" src="/dialog/images/icon/'+str+'.png" /><p class="info-text">'+msg+'</p>',
                            autoClose: 500
                        });
                        setTimeout('window.location.href="list"',1000);
                    }else{
                        str = "fail";
                        msg = "更新失败";
                        $.dialog({
                            type: 'info',
                            contentHtml: '<img class="info-icon" src="/dialog/images/icon/'+str+'.png" /><p class="info-text">'+msg+'</p>',
                            autoClose: 1000
                        });
                        setTimeout('window.location.href="list"',1000);
                    }

                }
            });

            //初始化侧边栏
            $(".vertical-nav").verticalnav({
                speed: 400,
                align: "left"
            });

            //时间选择组件
            laydate.render({
                elem: '#test1' //指定元素
            });
            laydate.render({
                elem: '#test2' //指定元素
            });
            laydate.render({
                elem: '#test3' //指定元素
            });

            jQuery(document).ready(function ($) {
                $('.list22 ul li p').clickdown();
                $('.list-se p[class=title22]').clickup();
                $('.list22>ul>li').ad();
            });
        });
	</script>
</html>